package com.ruoyi.admin.domain;

import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.Objects;

/**
 * 每日数据统计类
 * 用于存储每天的订单和收益数据
 */
public class DailyData {
    private LocalDate date;         // 日期
    private Integer orders;         // 订单数量
    private BigDecimal earnings;    // 收益金额
    private BigDecimal gmv;         // 交易额

    // Getters and Setters
    public LocalDate getDate() {
        return date;
    }

    public void setDate(LocalDate date) {
        this.date = date;
    }

    public Integer getOrders() {
        return orders;
    }

    public void setOrders(Integer orders) {
        this.orders = orders;
    }

    public BigDecimal getEarnings() {
        return earnings;
    }

    public void setEarnings(BigDecimal earnings) {
        this.earnings = earnings;
    }

    public BigDecimal getGmv() {
        return gmv;
    }

    public void setGmv(BigDecimal gmv) {
        this.gmv = gmv;
    }

    /**
     * 设置默认值防止null
     */
    public void setDefaultValues() {
        this.orders = (this.orders != null) ? this.orders : 0;
        this.earnings = (this.earnings != null) ? this.earnings : BigDecimal.ZERO;
        this.gmv = (this.gmv != null) ? this.gmv : BigDecimal.ZERO;
    }
}